WaitLoop()

func WaitLoop()
   while 1
	  sleep(random(1000,1500,1))
	  $coord = PixelSearch(1444,850,1544,950,0x39F300,0)
	  If Not @error Then
		 ;send("o")
		 ;sleep(random(800,1000))
		 ;MouseMove(1318,341,8)
		 ;MouseClick("right")
		 ;MouseMove(1381,480,8)
		 MouseMove(1494,900,8)
		 MouseClick("left")
		 sleep(random(800,1000,1))
		 mousemove(730,618,8)
		 MouseClick("left")
		 Sleep(Random(23000,24000,1)) ;long join delay
		 profit()
	  EndIf
   WEnd
EndFunc

MouseMove(469,448)
MouseClick("left")
Sleep(1500)
MouseMove(560,60)
MouseClick("left")
Sleep(1500)


func profit()
   MouseMove(469,428,8)
   MouseClick("left")
   sleep(random(2000,2100,1))
   MouseMove(560,60)
   MouseClick("left")
   Sleep(random(2400,2500,1))
   
   send("{ESC}")
   Sleep(Random(500,750,1))
   MouseMove(836,902,8)
   Sleep(Random(500,750,1))
   MouseClick("left")
   sleep(random(800,1000))
   ;leaveGame()
EndFunc

func leaveGame()
   Send("{ESC}") ;depress escape
   MouseMove(839 + random(-2,2,1),562 + random(-2,2,1),8)
   mouseclick("left")
   Sleep(Random(1000,1500)) ;sleep while leave game is active
EndFunc